﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace game_for_test_helper
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        SpriteFont font;
        Vector2 fontpos;
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }
        protected override void Initialize()
        {
            fontpos = new Vector2(2, 10);
            base.Initialize();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("Fonts/SpriteFont");
        }
        protected override void UnloadContent()
        {
        }
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
            if (GamePad.GetState(PlayerIndex.One).DPad.Up == ButtonState.Pressed)
                fontpos.Y -= 5;
            if (GamePad.GetState(PlayerIndex.One).DPad.Down == ButtonState.Pressed)
                fontpos.Y += 5;
            if (GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed)
                fontpos.X -= 5;
            if (GamePad.GetState(PlayerIndex.One).DPad.Right == ButtonState.Pressed)
                fontpos.X += 5;
            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();
            string MyMessage = gameTime.TotalRealTime.ToString();
            spriteBatch.DrawString(font,MyMessage, fontpos, Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}
